import request from '@/utils/request'

// 查询单据管理列表
export function listRetail(query) {
  return request({
    url: '/bill/retail/list',
    method: 'get',
    params: query
  })
}

// 查询单据管理详细
export function getRetail(id) {
  return request({
    url: '/bill/retail/' + id,
    method: 'get'
  })
}

// 新增单据管理
export function addRetail(data) {
  return request({
    url: '/bill/retail',
    method: 'post',
    data: data
  })
}

// 修改单据管理
export function updateRetail(data) {
  return request({
    url: '/bill/retail',
    method: 'put',
    data: data
  })
}

// 删除单据管理
export function delRetail(id) {
  return request({
    url: '/bill/retail/' + id,
    method: 'delete'
  })
}

// 获取单据编号
export function getBillNo(type) {
  return request({
    url: '/bill/retail/getBillNo/' + type,
    method: 'get'
  })
}

// 修改单据状态
export function updateRetailStatus(ids,status) {
  return request({
    url: '/bill/retail/' + status + '/' + ids,
    method: 'get'
  })
}
//采购统计
export function buyIn(query) {
  return request({
    url: '/bill/retail/buyIn',
    method: 'get',
    params: query
  })
}
//销售统计统计
export function saleOut(query) {
  return request({
    url: '/bill/retail/saleOut',
    method: 'get',
    params: query
  })
}

//入库出库明细接口
export function findInDetail(query) {
  return request({
    url: '/bill/retail/findInDetail',
    method: 'get',
    params: query
  })
}

//调拨明细统计
export function findAllocationDetail(query) {
  return request({
    url: '/bill/retail/findAllocationDetail',
    method: 'get',
    params: query
  })
}

//入库出库统计
export function findInOutMaterialCount(query) {
  return request({
    url: '/bill/retail/findInOutMaterialCount',
    method: 'get',
    params: query
  })
}


//进销存统计
export function findInOutStockReport(query) {
  return request({
    url: '/bill/retail/findInOutStockReport',
    method: 'get',
    params: query
  })
}
//进销存统计金额
export function findInOutStockReportTotalCountMoney(query) {
  return request({
    url: '/bill/retail/findInOutStockReportTotalCountMoney',
    method: 'get',
    params: query
  })
}

//对账单接口
export function findStatementAccount(query) {
  return request({
    url: '/bill/retail/findStatementAccount',
    method: 'get',
    params: query
  })
}

//库存预警报表
export function findStockWarningCount(query) {
  return request({
    url: '/bill/retail/findStockWarningCount',
    method: 'get',
    params: query
  })
}

//根据商品ID查询流水
export function findDetailByTypeAndMaterialId(query) {
  return request({
    url: '/bill/retail/findDetailByTypeAndMaterialId',
    method: 'get',
    params: query
  })
}

//根据编号查询单据信息
export function findBillDetailByNumber(query) {
  return request({
    url: '/bill/retail/getDetailByNumber',
    method: 'get',
    params: query
  })
}

// 查询单据附表商品详细
export function getZnDepotItemByHeadId(headId) {
  return request({
    url: '/bill/retail/getItems/' + headId,
    method: 'get'
  })
}

//单据明细列表
export function getDetailList(query) {
  return request({
    url: '/bill/retail/getDetailList',
    method: 'get',
    params: query
  })
}

//欠款单据查询
export function listDebt(query) {
  return request({
    url: '/bill/retail/listDebt',
    method: 'get',
    params: query
  })
}

//首页今天统计数据
export function todayReport() {
  return request({
    url: '/bill/retail/todayReport',
    method: 'get'
  })
}

//首页本月统计数据
export function monthReport() {
  return request({
    url: '/bill/retail/monthReport',
    method: 'get'
  })
}
//首页近6个月统计数据
export function lastSixMonthReport() {
  return request({
    url: '/bill/retail/lastSixMonthReport',
    method: 'get'
  })
}
